UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/CqOMjWCwUvfJaCqrdEYnZ0winGZaoO8VcAns+gChw=' 
WHERE 
  key_id = '581e06cb803f7469cd353f9c61ee6c4940b06d8c4a582929f18bfe56025618f9' 
  AND (
    token = 'S/CqOMjWCwUvfJaCqrdEYnZ0winGZaoO8VcAns+gChw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029