UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sm3WhV+NYNTiLeoKAjQqTeIGewEHmGOd4aSwX113LRE=' 
WHERE 
  key_id = '69f43f60e46eba6e157191c0144d5fcf98f9c782cebdf6832cdf0396bee58a7d' 
  AND (
    token = 'sm3WhV+NYNTiLeoKAjQqTeIGewEHmGOd4aSwX113LRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046