UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fWmuCoE1oMEnSVnrGpKOtrxHUnv2ks74zKe+kOGbTAw=' 
WHERE 
  key_id = 'e4046374d848214845b55464e80ec30d2a946e0f65069b8dd3497d56189b3c54' 
  AND (
    token = 'fWmuCoE1oMEnSVnrGpKOtrxHUnv2ks74zKe+kOGbTAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028