UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PX+oxkQ+oFbCYVYnSwGBD5jHMjTtxuuRp9aNiyBoOh4=' 
WHERE 
  key_id = '249214513448d1df678490e1c612154fa753099487e6fc76993a5cd75b3ab5fa' 
  AND (
    token = 'PX+oxkQ+oFbCYVYnSwGBD5jHMjTtxuuRp9aNiyBoOh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042