UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p2D921n2DzgmwlNqta+Ma9r3MRq1Tv/seClamFRW1Og=' 
WHERE 
  key_id = '8a3a532b5d137bfa8ade8ed62a8760b0a2e500278dc9e843d955ff6164393a5f' 
  AND (
    token = 'p2D921n2DzgmwlNqta+Ma9r3MRq1Tv/seClamFRW1Og=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030