UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QccZ0IImHh5W981vK6fwEd/OWeFFQ0cPSC92y2HLpyw=' 
WHERE 
  key_id = '8b8baa932851193c20371c43ceac3ae94632c829fa50c63d6b09e31a2c415c77' 
  AND (
    token = 'QccZ0IImHh5W981vK6fwEd/OWeFFQ0cPSC92y2HLpyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039