UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u7utNAZ1JK0xjfX6Nvsuxdw+eUuEwUDr79DTvfdGJmc=' 
WHERE 
  key_id = '1cbe317c5f417e8c9b13a1ced4ee0e86f9f12346c5c370985adafaa9a7738870' 
  AND (
    token = 'u7utNAZ1JK0xjfX6Nvsuxdw+eUuEwUDr79DTvfdGJmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029