UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oY5M6FJx+moVfMCW5RymHM8OxJzk+AQBopnhwOpbbxE=' 
WHERE 
  key_id = 'd7892b0732e0ed0feeb9421d46f39573c9249c5b4d30ede88d4293f3d23388e6' 
  AND (
    token = 'oY5M6FJx+moVfMCW5RymHM8OxJzk+AQBopnhwOpbbxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026