UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1MjvfqijyheqRRnExPxhU0QZBaXDvU0zeRoMztUqrHM=' 
WHERE 
  key_id = '85020e8230d8d60a29260ce33cea5d054c35f61fe1ee17166a7ff6335d13a46e' 
  AND (
    token = '1MjvfqijyheqRRnExPxhU0QZBaXDvU0zeRoMztUqrHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031