UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w6OhFJQ7Wt2pnMhCX95uYGjNacc88L00JbSv+wPLmt8=' 
WHERE 
  key_id = 'e9919915b548e20808a48289b1251eda1ae0e5f1b2e2e6504da755467df9abf5' 
  AND (
    token = 'w6OhFJQ7Wt2pnMhCX95uYGjNacc88L00JbSv+wPLmt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042