UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HPGbtHfaObfzLVNh2UqYLVyEWb9Eiac9Ay2RvZ2N9EU=' 
WHERE 
  key_id = 'aac91d074025a129a4def68bb91e4efa8477d20dfb5a9bf66e2764eb26719ae1' 
  AND (
    token = 'HPGbtHfaObfzLVNh2UqYLVyEWb9Eiac9Ay2RvZ2N9EU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029