UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a58cTnInyEcUf2SU0BYXm/az9rLrX5wyJ4VUDfsovcM=' 
WHERE 
  key_id = '7699e3f2c2e33079eac18165160e9289a525c201ee4b7ce1c82b27d7122229b2' 
  AND (
    token = 'a58cTnInyEcUf2SU0BYXm/az9rLrX5wyJ4VUDfsovcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026