UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0CjhOy8QGfeFlKHVzwVZQGOZMAyiBjn2cuxEkEFxoKw=' 
WHERE 
  key_id = '2cc3185b3e1b8a7b22cd237fda4c01b065306693e012434cfc638a347abfa82f' 
  AND (
    token = '0CjhOy8QGfeFlKHVzwVZQGOZMAyiBjn2cuxEkEFxoKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048