UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qd0KtXFT+wPXTo+qa37CZX6e1oGz+iE63lyzoy2Tbwg=' 
WHERE 
  key_id = '1cf44b36459b92a48d018139d62c9727108f3cf326650759bdeba660465309df' 
  AND (
    token = 'qd0KtXFT+wPXTo+qa37CZX6e1oGz+iE63lyzoy2Tbwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020