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

Query time 0.00027