UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4IW1J8BZyNlblWqXS2f+quXrgteXszWkr/jvYKZSxpI=' 
WHERE 
  key_id = 'e13e60c7fcc1d4d67ff471411c9864ecb409d319cfd641923e772ca245516728' 
  AND (
    token = '4IW1J8BZyNlblWqXS2f+quXrgteXszWkr/jvYKZSxpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029