UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g3AjhJQ3f4Cq4BUyY+7YoZ5etSxa+xLYXFuAej7B7GE=' 
WHERE 
  key_id = '2a8a73944772db5a109e49514f9fd3f7c200d109aee812c0140af0e9e9cb8b10' 
  AND (
    token = 'g3AjhJQ3f4Cq4BUyY+7YoZ5etSxa+xLYXFuAej7B7GE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046