UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ChCzOABr0OCz6/CeqLWYD7b8mjoyjxo0Zk/GeJ+Tw68=' 
WHERE 
  key_id = '96227bc15d384de0025b709e52f857315ec8f2eaf538e5c15cd0ae56d784ceb7' 
  AND (
    token = 'ChCzOABr0OCz6/CeqLWYD7b8mjoyjxo0Zk/GeJ+Tw68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025