UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9RfwyKwActWlgacxX17qlwpGAQ2fqYWKI7OxMITDEvw=' 
WHERE 
  key_id = '5ad485b9330e6bb6e5408d106cd4ff7fe86d616fe030e694e5c4244adad92392' 
  AND (
    token = '9RfwyKwActWlgacxX17qlwpGAQ2fqYWKI7OxMITDEvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030