UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GuYsp116y4JAiWTQgISVpsT6OdEL3rA1o89hhXBeb3Q=' 
WHERE 
  key_id = '471cc599e31aa152cc84f47ce4fa25a27b1e8ebfcf522d2c49a46cbb33604281' 
  AND (
    token = 'GuYsp116y4JAiWTQgISVpsT6OdEL3rA1o89hhXBeb3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032