UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XbC8XQvgQf8m1/Q4oAngmSHBLm+Xpdlp4rbskEUFqdE=' 
WHERE 
  key_id = 'beec22274a8f3e997c52b9db6ef4c9611849b144e4417c3275bbc86e79b6782e' 
  AND (
    token = 'XbC8XQvgQf8m1/Q4oAngmSHBLm+Xpdlp4rbskEUFqdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043