UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZ0R+aUYMrH6Qe9KLLTrbroS2EzkgZQZFjGYSL9/z28=' 
WHERE 
  key_id = '96381abb2993411d05264d954473179bcb2bf7b0e1e73f8ebf88d2d9ad25f608' 
  AND (
    token = 'YZ0R+aUYMrH6Qe9KLLTrbroS2EzkgZQZFjGYSL9/z28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032