UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zmozSwNAkFe/sXH72zaRACSyZEQegbLGpgAqMwl3C+w=' 
WHERE 
  key_id = '6ab0a69a3ac07af6445ea39a5cfc29d59b01102e734110281eee3b785298a0a5' 
  AND (
    token = 'zmozSwNAkFe/sXH72zaRACSyZEQegbLGpgAqMwl3C+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025