UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'esONSkUZaGAAsHo4DBjnCUWi5Esjmdqg4rDxAlwOWx0=' 
WHERE 
  key_id = 'fd9e3faa4cdc9539a6ca4aaacb577b945caf6a8737de602f1f146a6d7e5023d2' 
  AND (
    token = 'esONSkUZaGAAsHo4DBjnCUWi5Esjmdqg4rDxAlwOWx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035