UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OzOKk3pEMQV9+C0N6PSe0p9Hn+QZPxYHnM8mvBl6NHE=' 
WHERE 
  key_id = '901401aad91bb041d6319e9e7b13c85f9698bf0364ca47a15c4820f91e20d170' 
  AND (
    token = 'OzOKk3pEMQV9+C0N6PSe0p9Hn+QZPxYHnM8mvBl6NHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037