UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZPb8dS9W6mixCO0My4+tBBlddOgEID6teTzwf52vwmk=' 
WHERE 
  key_id = '094ba15b0555e40d0deadae67f32b5e56088b93908a33a3280ab77873c7870cf' 
  AND (
    token = 'ZPb8dS9W6mixCO0My4+tBBlddOgEID6teTzwf52vwmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030