UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CDlT2PQWwee587xOC2GG1Dc0Pyt3aKMkwoQSLn1uaY0=' 
WHERE 
  key_id = '6b33e0ddd4d1925649e37c9357a457c765decc2c50e4cbb305af1ee7151a06eb' 
  AND (
    token = 'CDlT2PQWwee587xOC2GG1Dc0Pyt3aKMkwoQSLn1uaY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042