UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JYw5HQZzvzT1kN70lHBuNg+OANnCuBojuawiCIIlXPU=' 
WHERE 
  key_id = '31b184f1c95c67947147be373462f269e2ba9574a1f89dd2cb514d80cf45bd74' 
  AND (
    token = 'JYw5HQZzvzT1kN70lHBuNg+OANnCuBojuawiCIIlXPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030