UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B3HYricgiZ72wVAbjrp/fwqkokoN/6Ercak60EhTm2o=' 
WHERE 
  key_id = 'ba64286d76039af89fd01b6c52e9360b6953ecc21c5d6374cf864c2778efea68' 
  AND (
    token = 'B3HYricgiZ72wVAbjrp/fwqkokoN/6Ercak60EhTm2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043