UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'diVWGxtf8yjszFA07yn+Vy/6wKErcVzs96kJzLTHy8Q=' 
WHERE 
  key_id = '49081854b733bab5465dc2484e4672f4b8e6936f34fe2177b6600e5b4fab8809' 
  AND (
    token = 'diVWGxtf8yjszFA07yn+Vy/6wKErcVzs96kJzLTHy8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034