UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ehUtfoYY2YIdJqx3WpemxEaRCjne+Ov4jV4i01Pwsmk=' 
WHERE 
  key_id = '04c6a79729222d22824a5ec107dd49e382028b36682be55b1521e361a0e3f26c' 
  AND (
    token = 'ehUtfoYY2YIdJqx3WpemxEaRCjne+Ov4jV4i01Pwsmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031